package com.test.thread;

/**
 * @Classname MyTask
 * @Description TODO
 * @Date 2025/3/6 17:19
 * @Created by rgs
 */
public class MyTask implements Runnable {

    private String name;

    public MyTask(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    @Override
    public void run() {
        System.out.println("我是线程任务，我的名字是" + name+"我正在执行任务......");
        try {
            Thread.sleep(1000); // 模拟任务执行时间
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
}
